$OpenBSD: patch-libs_maildir_maildircache_c,v 1.1 2015/04/28 07:20:02 giovanni Exp $
fix a use-after-free

--- libs/maildir/maildircache.c.orig	Thu Apr 23 23:58:45 2015
+++ libs/maildir/maildircache.c	Fri Apr 24 00:00:09 2015
@@ -249,17 +249,18 @@ FILE	*fp;
 			exit(1);
 		}
 	}
-	free(f);
 
 	if ( fwrite(data, strlen(data), 1, fp) != 1 || fflush(fp)
 	     || ferror(fp))
 	{
 		fclose(fp);
 		unlink(f);	/* Problems */
+		free(f);
 		fprintf(stderr, "CRIT: maildircache: Cache create failure - write error.\n");
 		exit(1);
 	}
 	else	fclose(fp);
+	free(f);
 	exit(0);
 }
 
